<?php
/*************************************************************************
  Graphic User Interface EAI V.1
  author: pma
 ************************************************************************/ 
include("lib/pChart2.1.3/class/pData.class.php");
include("lib/pChart2.1.3/class/pDraw.class.php");
include("lib/pChart2.1.3/class/pImage.class.php");

include("lib/pChart2.1.3/class/pRadar.class.php");
include("lib/pChart2.1.3/class/pPie.class.php");

//============================================================================
// TYPE GRAPH
//============================================================================
$GRAPH_COMPETENCES  = 0;
$GRAPH_EVALUATION   = 1;
$GRAPH_TREND        = 2;
$GRAPH_PREVIOUS_OBJ = 3;
$GRAPH_FUTUR_OBJ    = 4;
$GRAPH_SATISFACTION = 5;
$GRAPH_TRAINING     = 6;


//============================================================================
// draw_radar()
//============================================================================
 function draw_radar($id_user,$tab_data)
 {
    try
    {
        GLOBAL $PATH_CACHE_CHART,$PATH_FONT_CHART ; 
		$name_radar = $PATH_CACHE_CHART.$id_user."_radar_".rand(1,10000).date("YmdHis").".png" ; 
        
        /* Create and populate the pData object */
		$MyData = new pData();   
		for($inc=0,$stop=(count($tab_data));$inc<$stop;$inc++)
		{
		    $tab_label =  array() ; 
		    $tab_score =  array() ; 
		    $serie_label    = "";
			
			for($inc2=0 , $stop2=(count($tab_data[$inc])-1); $inc2<$stop2 ; $inc2++) 
			{		
				if($inc2==0) $serie_label = $tab_data[$inc][$inc2][2] ; 
				array_push($tab_label,$tab_data[$inc][$inc2][0]);
				array_push($tab_score,$tab_data[$inc][$inc2][1]);
			}
			$MyData->addPoints($tab_score,$serie_label);  
		}
		/* Define the absissa serie */
		$MyData->addPoints($tab_label,"Labels");
		$MyData->setAbscissa("Labels");
		
		/* Create the pChart object */
		$myPicture = new pImage(700,300,$MyData);
		
		/* Overlay some gradient areas */
		$Settings = array("StartR"=>255, "StartG"=>255, "StartB"=>255, "EndR"=>255, "EndG"=>255, "EndB"=>0, "Alpha"=>0);
		$myPicture->drawGradientArea(0,0,700,230,DIRECTION_VERTICAL,$Settings);
		$myPicture->drawGradientArea(0,0,700,20,DIRECTION_VERTICAL,$Settings);
		
		/* Set the default font properties */ 
		$myPicture->setFontProperties(array("FontName"=>$PATH_FONT_CHART."Forgotte.ttf","FontSize"=>12,"R"=>80,"G"=>80,"B"=>80));
		
		/* Create the pRadar object */ 
		$SplitChart = new pRadar();
		
		/* Draw a radar chart */ 
		$myPicture->setGraphArea(10,25,700,225);
		$Options = array( "SegmentHeight"=>1,"Segments"=>5,"DrawPoly"=>false,"Layout"=>RADAR_LAYOUT_STAR,"LabelPos"=>RADAR_LABELS_HORIZONTAL, "FontName"=>"../fonts/pf_arma_five.ttf","FontSize"=>12);
		$SplitChart->drawRadar($myPicture,$MyData,$Options);
		
		$myPicture->drawLegend(650,105,array("Style"=>LEGEND_NOBORDER,"Mode"=>LEGEND_VERTICAL));
		
		
		/* Render the picture (choose the best way) */
		$myPicture->Render($name_radar);
		return $name_radar ; 
	}
	catch (Exception $e)
	{
		throw new Exception($e->getMessage());
	}
 }
 
//============================================================================
// draw_bar_trend()
//============================================================================
// function draw_bar_trend($id_user,$tab_data)
// {
//    try
//    {
//        GLOBAL $PATH_CACHE_CHART,$PATH_FONT_CHART ; 
//        $name_bar = $PATH_CACHE_CHART.$id_user."_bar_trend".rand(1,10000).date("YmdHis").".png" ; 
//        
//        /* Create and populate the pData object */
//		$MyData = new pData();  
//		for($inc=0,$stop=(count($tab_data));$inc<$stop;$inc++)
//		{
//		 	for($inc2=0 , $stop2=(count($tab_data[$inc])-1); $inc2<$stop2 ; $inc2++) 
//			{				
//				$MyData->addPoints($tab_data[$inc][$inc2][1],$tab_data[$inc][$inc2][0]);
//			}
//			$MyData->addPoints(array(" "),"Labels");
//			$MyData->setAbscissa("Labels");
//				
//			/* Create the pChart object */
//			$myPicture = new pImage(700,230,$MyData);
//			
//			/* Write the chart title */ 
//			$myPicture->setFontProperties(array("FontName"=>$PATH_FONT_CHART."Forgotte.ttf","FontSize"=>18));
//			$myPicture->drawText(250,45,"Répartition des tendances",array("FontSize"=>20,"Align"=>TEXT_ALIGN_BOTTOMMIDDLE));
//			 
//			 /* Draw the scale and the 1st chart */
//			$myPicture->setFontProperties(array("FontName"=>$PATH_FONT_CHART."Forgotte.ttf","FontSize"=>12));
//			$myPicture->setGraphArea(60,60,450,190);
//			$myPicture->drawScale(array("DrawSubTicks"=>FALSE));
//			$myPicture->setShadow(TRUE,array("X"=>1,"Y"=>1,"R"=>0,"G"=>0,"B"=>0,"Alpha"=>10));
//			$settings = array("Gradient"=>TRUE,"DisplayValues"=>TRUE,"DisplayR"=>0,"DisplayG"=>0,"DisplayB"=>0,"DisplayShadow"=>TRUE,"Surrounding"=>10); 
//			$myPicture->drawBarChart($settings);
//			$myPicture->setShadow(FALSE);
//		    
//			/* Write the chart legend */
//			$myPicture->drawLegend(500,105,array("Style"=>LEGEND_NOBORDER,"Mode"=>LEGEND_VERTICAL));
//			
//			/* Render the picture (choose the best way) */
//		}
//		$myPicture->Render($name_bar);
//		
//		return $name_bar ; 
//	}
//	catch (Exception $e)
//	{
//		throw new Exception($e->getMessage());
//	}
// }
//============================================================================
// draw_bars()
//============================================================================
 function draw_bars($id_user,$tab_data,$title,$orientation=0)
 {
    try
    {
        GLOBAL $PATH_CACHE_CHART,$PATH_FONT_CHART ; 
        $name_bar = $PATH_CACHE_CHART.$id_user."_bar_".rand(1,10000).date("YmdHis").".png" ; 
        
        /* Create and populate the pData object */
		$MyData = new pData();  

		for($inc=0,$stop=(count($tab_data));$inc<$stop;$inc++)
		{
			$tab_label =  array() ;     
		    $tab_score =  array() ; 
			$serie_label    = "";
			
			for($inc2=0 , $stop2=(count($tab_data[$inc])-1); $inc2<$stop2 ; $inc2++) 
			{				
				if($inc2==0) $serie_label = $tab_data[$inc][$inc2][2]."  " ; 
				array_push($tab_label,$tab_data[$inc][$inc2][0]);
				array_push($tab_score,$tab_data[$inc][$inc2][1]);
			}
			$MyData->addPoints($tab_score,$serie_label);
			
		}
		$MyData->addPoints($tab_label,"Labels");
		$MyData->setSerieDescription("Labels","Label");
		$MyData->setAbscissa("Labels");
		
		/* Create the pChart object */
		$myPicture = new pImage(750,($orientation==1)?700:360,$MyData);
		
		/* Turn of Antialiasing */
		$myPicture->Antialias = FALSE;
		
		/* Set the default font */
		$myPicture->setFontProperties(array("FontName"=>$PATH_FONT_CHART."Forgotte.ttf","FontSize"=>12));
		
		/* Define the chart area */
		if($orientation==1)
			$myPicture->setGraphArea(260,40,650,600);
		else
			$myPicture->setGraphArea(60,40,750,300);
		
		/* Draw the scale */
		if($orientation==1)
			$scaleSettings = array("Pos"=>SCALE_POS_TOPBOTTOM, "GridR"=>200,"GridG"=>200,"GridB"=>200,"DrawSubTicks"=>TRUE,"CycleBackground"=>TRUE);
		else
			$scaleSettings = array("DrawYLines"=>NONE  , "GridR"=>200,"GridG"=>200,"GridB"=>200,"DrawSubTicks"=>TRUE,"CycleBackground"=>TRUE );
		
		$myPicture->drawScale($scaleSettings);
		
		/* Turn on shadow computing */ 
		$myPicture->setShadow(TRUE,array("X"=>1,"Y"=>1,"R"=>0,"G"=>0,"B"=>0,"Alpha"=>10));
		
		/* Write the chart title */ 
		if($orientation==1)
			$myPicture->drawText(375,20,$title,array("FontSize"=>20,"Align"=>TEXT_ALIGN_BOTTOMMIDDLE));
		else
			$myPicture->drawText(375,25,$title,array("FontSize"=>20,"Align"=>TEXT_ALIGN_BOTTOMMIDDLE));
		
		/* Draw the chart */
		$myPicture->setShadow(TRUE,array("X"=>1,"Y"=>1,"R"=>0,"G"=>0,"B"=>0,"Alpha"=>10));
		$settings = array("Gradient"=>TRUE,"DisplayValues"=>TRUE,"DisplayR"=>0,"DisplayG"=>0,"DisplayB"=>0,"DisplayShadow"=>TRUE,"Surrounding"=>10);
		$myPicture->drawBarChart($settings);

        if($orientation==1)
            $myPicture->drawLegend(350,680,array("Style"=>LEGEND_NOBORDER,"Mode"=>LEGEND_HORIZONTAL));
        else
            $myPicture->drawLegend(350,350,array("Style"=>LEGEND_NOBORDER,"Mode"=>LEGEND_HORIZONTAL));
		 /* Render the picture (choose the best way) */
		$myPicture->Render($name_bar);
		
		return $name_bar ; 
	}
	catch (Exception $e)
	{
		throw new Exception($e->getMessage());
	}
 }

//============================================================================
// draw_2D_ring()
//============================================================================
 function draw_2D_ring($id_user,$tab_data,$title)
 {
    try
    {
        GLOBAL $PATH_CACHE_CHART,$PATH_FONT_CHART ; 
        $name_img = $PATH_CACHE_CHART.$id_user."_2D_ring_".rand(1,10000).date("YmdHis").".png" ; 
        
        /* Create and populate the pData object */
		$MyData = new pData() ;   
		$tab_label =  array() ; 
		$tab_score =  array() ; 
		for($inc=0,$stop=(count($tab_data)-1);$inc<$stop;$inc++)
		{
			array_push($tab_label,$tab_data[$inc][0]);
			array_push($tab_score,$tab_data[$inc][1]);	
		}
		$MyData->addPoints($tab_score,"Score");
		$MyData->addPoints($tab_score,"Labels");
		$MyData->setSerieDescription("Labels","Label");
		$MyData->setAbscissa("Labels");
		
		/* Create the pChart object */
		$myPicture = new pImage(700,260,$MyData);
		
		/* Write the picture title */ 
		$myPicture->setFontProperties(array("FontName"=>$PATH_FONT_CHART."Forgotte.ttf","FontSize"=>14));
		
		/* Write the chart title */ 
		$myPicture->drawText(350,25,$title,array("FontSize"=>16,"Align"=>TEXT_ALIGN_BOTTOMMIDDLE));
		
		/* Set the default font properties */ 
		$myPicture->setFontProperties(array("FontName"=>$PATH_FONT_CHART."Forgotte.ttf","FontSize"=>12,"R"=>80,"G"=>80,"B"=>80));
		
		/* Enable shadow computing */ 
		$myPicture->setShadow(TRUE,array("X"=>2,"Y"=>2,"R"=>0,"G"=>0,"B"=>0,"Alpha"=>50));
		
		/* Create the pPie object */ 
		$PieChart = new pPie($myPicture,$MyData);
		
		/* Draw an AA pie chart */ 
		$PieChart->draw2DRing(260,140,array("DrawLabels"=>TRUE,"LabelStacked"=>TRUE,"WriteValues"=>FALSE,"ValuePosition" => PIE_VALUE_OUTSIDE,"ValueR"=>0,"ValueG"=>0,"ValueB"=>0,"Border"=>TRUE));
		
		/* Write the legend box */ 
		$myPicture->setShadow(FALSE);
		$MyData->addPoints($tab_label,"Labels2");
		$MyData->setAbscissa("Labels2");
		
		$PieChart->drawPieLegend(550,80,array("FontSize"=>16,"Style"=>LEGEND_ROUND));
		
		/* Render the picture (choose the best way) */
		$myPicture->Render($name_img);
		
		return $name_img ; 
    }
    catch (Exception $e)
	{
		throw new Exception($e->getMessage());
	}
 }
 //============================================================================
// gui_eai_btn_next()
//============================================================================
 function gui_eai_btn_next()
 {
    try
    {
        GLOBAL  $ICON_NEXT ;
        
        $StrReturn = ""; 
        $StrReturn .= gui_jqueryui_ul_open();
	    $StrReturn .= gui_table_tag_open();
			$StrReturn .= gui_tr_tag_empty(1,2);
			$StrReturn .= gui_tr_tag_open();
				
				$StrReturn .= gui_td_tag(" ","98%");
				
				$StrReturn .= gui_td_tag_open("2%","right",NULL,NULL,NULL,NULL,NULL,NULL);
					$StrReturn .= gui_jqueryui_li_icon($ICON_NEXT,"onclick=\"javascript: document.eai_creation_stage.submit();\"");
				$StrReturn .= gui_td_tag_close();
			
			$StrReturn .= gui_tr_tag_close();
			$StrReturn .= gui_tr_tag_empty(1,2);
		$StrReturn .= gui_table_tag_close();
		$StrReturn .= gui_jqueryui_ul_close();
		return $StrReturn ;
	}
	catch (Exception $e)
	{
		throw new Exception($e->getMessage());
	}
 }
//============================================================================
// gui_eai_btn_last_and_next()
//============================================================================
 function gui_eai_btn_last_and_next($id_eai=NULL,$display=NULL,$before_last_stage=NULL)
 {
    try
    {
        GLOBAL  $MOVE_NEXT, $ICON_NEXT, $ICON_LAST;
        
        $StrReturn = ""; 
        $StrReturn .= gui_jqueryui_ul_open();
        if($id_eai!=NULL)
        {
	        //formulaire qui renvoie sur la dernière étape
			$StrReturn .= gui_form_post_open("eai_update_stage_end");
				$StrReturn .= gui_form_input_hidden_field("operation" ,"eai_update_stage");
				$StrReturn .= gui_form_input_hidden_field("id_eai" ,$id_eai);
				$StrReturn .= gui_form_input_hidden_field("id_stage" ,$before_last_stage);
				$StrReturn .= gui_form_input_hidden_field("requete" ,$display);
				$StrReturn .= gui_form_input_hidden_field("move" ,$MOVE_NEXT);
			$StrReturn .= gui_form_post_close();
		}
		
	    $StrReturn .= gui_table_tag_open();
			$StrReturn .= gui_tr_tag_empty(1,3);
			$StrReturn .= gui_tr_tag_open();
				
				$StrReturn .= gui_td_tag(" ","100%");
				
				$StrReturn .= gui_td_tag_open("","right",NULL,NULL,NULL,NULL,NULL,NULL);
					$StrReturn .= gui_jqueryui_li_icon($ICON_NEXT,"onclick=\"javascript: document.eai_creation_stage.submit();\"");
				$StrReturn .= gui_td_tag_close();
				
				$StrReturn .= gui_td_tag_open("","right",NULL,NULL,NULL,NULL,NULL,NULL);
					$StrReturn .= gui_jqueryui_li_icon($ICON_LAST,"onclick=\"javascript: document.eai_update_stage_end.submit();\"");
				$StrReturn .= gui_td_tag_close();
			
			$StrReturn .= gui_tr_tag_close();
			$StrReturn .= gui_tr_tag_empty(1,3);
		$StrReturn .= gui_table_tag_close();
		$StrReturn .= gui_jqueryui_ul_close();
		return $StrReturn ;
	}
	catch (Exception $e)
	{
		throw new Exception($e->getMessage());
	}
 }
//============================================================================
// gui_eai_btn_previous_and_next()
// méthode utilisée pour afficher les deux boutons "Etape précédente" & "Etape suivante"
// Les paramètres d'entrée ($id_eai,$display,$before_last_stage) ne doivent être passé 
// qu'une seule fois en entête pour l'écriture des formulaire cachés
//============================================================================
 function gui_eai_btn_previous_and_next($id_eai=NULL,$display=NULL,$before_last_stage=NULL, $current_stage=NULL,$id_second_stage=2)
 {
    try
    {
        GLOBAL  $ICON_FIRST,$ICON_PREVIOUS,$ICON_NEXT,$ICON_LAST,$ICON_SAVE,
                $DISPLAY_UPDATE, $DISPLAY_UPDATE_EVALUE,
                $MOVE_BACK, $MOVE_NEXT;
        
        $StrReturn = ""; 
        $StrReturn .= gui_jqueryui_ul_open();
        if($id_eai!=NULL)
        {
	        //formulaire qui renvoie sur la première étape
	        $StrReturn .= gui_form_post_open("eai_select_stage_start");
				$StrReturn .= gui_form_input_hidden_field("operation" ,"eai_update_stage");
				$StrReturn .= gui_form_input_hidden_field("id_eai" ,$id_eai);
				// A préciser que nous allons à la page 1 en faisant croire à la page eai.php que nous arrivons de la 2 avec l'option $MOVE_BACK
				$StrReturn .= gui_form_input_hidden_field("id_stage" ,$id_second_stage);
				$StrReturn .= gui_form_input_hidden_field("requete" ,(($display == $DISPLAY_UPDATE_EVALUE)?$DISPLAY_UPDATE_EVALUE:$DISPLAY_UPDATE));
				$StrReturn .= gui_form_input_hidden_field("move" ,$MOVE_BACK);
			$StrReturn .= gui_form_post_close();
			
			//formulaire qui renvoie sur la dernière étape
			$StrReturn .= gui_form_post_open("eai_update_stage_end");
				$StrReturn .= gui_form_input_hidden_field("operation" ,"eai_update_stage");
				$StrReturn .= gui_form_input_hidden_field("id_eai" ,$id_eai);
				$StrReturn .= gui_form_input_hidden_field("id_stage" ,$before_last_stage);
				$StrReturn .= gui_form_input_hidden_field("requete" ,$display);
				$StrReturn .= gui_form_input_hidden_field("move" ,$MOVE_NEXT);
			$StrReturn .= gui_form_post_close();
		}
		
		
	    $StrReturn .= gui_table_tag_open("100%");
			$StrReturn .= gui_tr_tag_empty(1,7);
			$StrReturn .= gui_tr_tag_open();
				
				$StrReturn .= gui_td_tag_open("","left",NULL,NULL,NULL,NULL,NULL,NULL);
					$StrReturn .= gui_jqueryui_li_icon($ICON_FIRST,"onclick=\"javascript: document.eai_select_stage_start.submit();\"");
				$StrReturn .= gui_td_tag_close();
				
				$StrReturn .= gui_td_tag_open("","left",NULL,NULL,NULL,NULL,NULL,NULL);
					$StrReturn .= gui_jqueryui_li_icon($ICON_PREVIOUS,"onclick=\"javascript: document.eai_select_stage.submit();\"");
				$StrReturn .= gui_td_tag_close();
				
				$StrReturn .= gui_td_tag(" ","50%");
				
				$StrReturn .= gui_td_tag_open("","center",NULL,NULL,NULL,NULL,NULL,NULL);
					$StrReturn .= gui_jqueryui_li_icon($ICON_SAVE,"onclick=\"javascript:    document.forms['eai_update_stage'].elements['operation'].value = 'eai_save_stage'; 
																							document.eai_update_stage.submit();\"");
				$StrReturn .= gui_td_tag_close();
				
				$StrReturn .= gui_td_tag(" ","50%");
				
				$StrReturn .= gui_td_tag_open("","right",NULL,NULL,NULL,NULL,NULL,NULL);
					$StrReturn .= gui_jqueryui_li_icon($ICON_NEXT,"onclick=\"javascript: document.eai_update_stage.submit();\"");
				$StrReturn .= gui_td_tag_close();
				
				$StrReturn .= gui_td_tag_open("","right",NULL,NULL,NULL,NULL,NULL,NULL);
					$StrReturn .= gui_jqueryui_li_icon($ICON_LAST,"onclick=\"javascript: document.eai_update_stage_end.submit();\"");
				$StrReturn .= gui_td_tag_close();
			
			$StrReturn .= gui_tr_tag_close();
			$StrReturn .= gui_tr_tag_empty(1,7);
		$StrReturn .= gui_table_tag_close();
		$StrReturn .= gui_jqueryui_ul_close();
		return $StrReturn ;
	}
	catch (Exception $e)
	{
		throw new Exception($e->getMessage());
	}
 }
 //============================================================================
// gui_eai_btn_previous_and_end()
//============================================================================
 function gui_eai_btn_previous_and_end($id_eai=NULL,$display=NULL,$id_second_stage=2)
 {
    try
    {
        GLOBAL  $LABEL_0110 , $LABEL_0109, $PAGE_0004,
                $ICON_FIRST,$ICON_PREVIOUS,$ICON_QUIT,
                $DISPLAY_UPDATE, $DISPLAY_UPDATE_EVALUE,
                $MOVE_BACK;
        
        $StrReturn = ""; 
        $StrReturn .= gui_jqueryui_ul_open();
        if($id_eai!=NULL)
        {
	        //formulaire qui renvoie sur la première étape
	        $StrReturn .= gui_form_post_open("eai_select_stage_start");
				$StrReturn .= gui_form_input_hidden_field("operation" ,"eai_update_stage");
				$StrReturn .= gui_form_input_hidden_field("id_eai" ,$id_eai);
				// A préciser que nous allons à la page 1 en faisant croire à la page eai.php que nous arrivons de la 2 avec l'option $MOVE_BACK
				$StrReturn .= gui_form_input_hidden_field("id_stage" ,$id_second_stage);
				$StrReturn .= gui_form_input_hidden_field("requete" ,(($display == $DISPLAY_UPDATE_EVALUE)?$DISPLAY_UPDATE_EVALUE:$DISPLAY_UPDATE));
				$StrReturn .= gui_form_input_hidden_field("move" ,$MOVE_BACK);
			$StrReturn .= gui_form_post_close();
		}
		
	    $StrReturn .= gui_table_tag_open();
			$StrReturn .= gui_tr_tag_empty(1,4);
			$StrReturn .= gui_tr_tag_open();
				
				$StrReturn .= gui_td_tag_open("","left",NULL,NULL,NULL,NULL,NULL,NULL);
					$StrReturn .= gui_jqueryui_li_icon($ICON_FIRST,"onclick=\"javascript: document.eai_select_stage_start.submit();\"");
				$StrReturn .= gui_td_tag_close();
				
				$StrReturn .= gui_td_tag_open("","left",NULL,NULL,NULL,NULL,NULL,NULL);
					$StrReturn .= gui_jqueryui_li_icon($ICON_PREVIOUS,"onclick=\"javascript: document.eai_select_stage.submit();\"");
				$StrReturn .= gui_td_tag_close();
				
				$StrReturn .= gui_td_tag(" ","100%");
				
				$StrReturn .= gui_td_tag_open("","right",NULL,NULL,NULL,NULL,NULL,NULL);
					$StrReturn .= gui_jqueryui_li_icon($ICON_QUIT,"onclick=\"javascript: location.href='".$PAGE_0004."';\"");
				$StrReturn .= gui_td_tag_close();
			
			$StrReturn .= gui_tr_tag_close();
			$StrReturn .= gui_tr_tag_empty(1,4);
		$StrReturn .= gui_table_tag_close();
		$StrReturn .= gui_jqueryui_ul_close();
		return $StrReturn ;
	}
	catch (Exception $e)
	{
		throw new Exception($e->getMessage());
	}
 }
//============================================================================
// gui_eai_show_data_1_part()
//============================================================================
function gui_eai_show_data_1_part($data,$colspan=NULL){
	try{
		$StrReturn = ""; 
		
		$StrReturn .= gui_tr_tag_open();
			$StrReturn .= gui_td_tag($data,"inherit","left",NULL,$colspan,NULL,"td_data",NULL,NULL);
		$StrReturn .= gui_tr_tag_close();
		
		return $StrReturn ;
	}
	catch (Exception $e)
	{
		throw new Exception($e->getMessage());
	}
}
//============================================================================
// gui_eai_show_data_2_parts()
//============================================================================
function gui_eai_show_data_2_parts($label,$data,$colspan_cel_right=NULL){
	try{
		$StrReturn = ""; 
		
		$StrReturn .= gui_tr_tag_open();
			$StrReturn .= gui_td_tag($label, "40%","left",NULL,NULL,NULL,"td_question",NULL,NULL);				
			$StrReturn .= gui_td_tag($data, "60%","left",NULL,$colspan_cel_right,NULL,"td_data",NULL,NULL);
		$StrReturn .= gui_tr_tag_close();
		
		return $StrReturn ;
	}
	catch (Exception $e)
	{
		throw new Exception($e->getMessage());
	}
}
//============================================================================
// gui_eai_show_data_3_parts()
//============================================================================
function gui_eai_show_data_3_parts($label,$grade,$data)
{
	try
	{
		$StrReturn = ""; 
		
		$StrReturn .= gui_tr_tag_open();
			$StrReturn .= gui_td_tag($label, "40%","left",NULL,NULL,NULL,NULL,NULL,NULL);				
			$StrReturn .= gui_td_tag($grade, "20%",NULL,NULL,NULL,NULL,"td_data",NULL,"text-align: center;");
			$StrReturn .= gui_td_tag($data, "40%","left",NULL,NULL,NULL,"td_data",NULL,NULL);
		$StrReturn .= gui_tr_tag_close();
		
		return $StrReturn ;
	}
	catch (Exception $e)
	{
		throw new Exception($e->getMessage());
	}
}

//============================================================================
// gui_eai_select_list_grade()
//============================================================================
function gui_eai_select_list_grade($id_list,$db_name)
{
	try
	{
		GLOBAL $REQUEST_113 ; 
		$StrReturn = ""; 
		$tab_arg		= array( ':id_list' 	=> $id_list	);
		$data	= db_request_select($REQUEST_113, $tab_arg ,$db_name);
		
		return $data;
	}
	catch (Exception $e)
	{
		throw new Exception($e->getMessage());
	}
}

//============================================================================
// gui_eai_show_list_grade()
//============================================================================
function gui_eai_show_list_grade($id_list,$db_name)
{
	try
	{
		GLOBAL $REQUEST_113, $LABEL_0103 ; 
		$StrReturn = ""; 
		$tab_arg		= array( ':id_list' 	=> $id_list	);
		$data	= db_request_select($REQUEST_113, $tab_arg ,$db_name);
		
		$StrReturn = $LABEL_0103." :"; 
		for($inc = 0, $stop=(count($data)-1); $inc<$stop;$inc++)
		{
			if($inc>0) $StrReturn .= " -" ; 
			$StrReturn .= " ".$data[$inc][1];
		}
		 return $StrReturn ;
		
	}
	catch (Exception $e)
	{
		throw new Exception($e->getMessage());
	}
}
//============================================================================
// gui_eai_show_list_grade()
//============================================================================
function gui_eai_show_list_grade_2($id_list,$db_name)
{
	try
	{
		GLOBAL $REQUEST_113, $LABEL_0103 ; 
		$StrReturn = ""; 
		$tab_arg		= array( ':id_list' 	=> $id_list	);
		$data	= db_request_select($REQUEST_113, $tab_arg ,$db_name);
		
		$StrReturn = "<b>".$LABEL_0103." :</b>"; 
		for($inc = 0, $stop=(count($data)-1); $inc<$stop;$inc++)
		{
			if($inc>0) $StrReturn .= " -" ; 
			$StrReturn .= " ".$data[$inc][1];
		}
		
		return gui_info_message_small($StrReturn) ;
	}
	catch (Exception $e)
	{
		throw new Exception($e->getMessage());
	}
}


?>